﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LoginRegister.ascx.cs" Inherits="Cart.LoginRegister" %>
<%--<div id="ctl00_content_divLogin">--%>
<script type="text/javascript">
    function script2() {
        var strHoTen = $("input[id$='txtHoTen']").val();
        if (strHoTen == '') {
            alert('Họ tên rỗng');
            return false;
        }
        if (strHoTen.length > 50) {
            alert('Họ tên quá dài');
            return false;
        }


        var strDiaChi = $("input[id$='txtDiaChi']").val();
        if (strDiaChi == '') {
            alert('Địa chỉ rỗng');
            return false;
        }
        if (strDiaChi.length > 250) {
            alert('Địa chỉ quá dài');
            return false;
        }

        var strPass = $("input[id$='txtPass3']").val();
        if (strPass == '') {
            alert('Mật khẩu rỗng');
            return false;
        }
        if (strPass.length > 20) {
            alert('Mật khẩu chỉ tối đa 20 kí tự');
            return false;
        }
        var strPass2 = $("input[id$='txtPass2']").val();
        if (strPass != strPass2) {
            alert('Hai mật khẩu phải trùng nhau');
            return false;
        }

        var strDienThoai = $("input[id$='txtDienThoai']").val();
        if (strDienThoai == '') {
            alert('Số điện thoại rỗng');
            return false;
        }
        if (strDienThoai.length > 11) {
            alert('Số điện thoại chỉ tối đa 11 kí tự');
            return false;
        }
        var reNumber = /^-{0,1}\d*\.{0,1}\d+$/;
        if (!reNumber.test(strDienThoai)) {
            alert('Số điện thoại sai định dạng');
            return false;
        }


        var myTextField =  $("input[id$='txtEmail']").val();
        if (myTextField == '') {
            alert('Email rỗng');
            return false;
        }
        if (myTextField.length > 25) {
            alert('Email chỉ tối đa 25 kí tự');
            return false;
        }
        var reEmail = /\S+@\S+\.\S+/;
        if (!reEmail.test(myTextField)) {
            alert('Email sai định dạng');
            return false;
        }
        return true;
    }
</script>
<p class="clear">
</p>
<p class="clear">
</p>
<p class="clear">
</p>
<p class="clear">
</p>
<p class="clear">
</p>
<p class="clear">
</p>
<p class="clear">
</p>
<p class="clear">
</p>
<p class="clear">
</p>
<p class="clear">
</p>
<p class="clear">
</p>
<p class="clear">
</p>
<p class="clear">
</p>
<p class="clear">
</p>
<p class="clear">
</p>

<p class="buy_cart_title">
    CHỌN 1 TRONG 2 <span class="buy_cart_title_small">(để hoàn tất)</span>
</p>

<!-- cart-login-open -->
<p class="buy_cart_title_finish" id="buy_cart_login">
    ĐĂNG NHẬP
</p>

<div style="display: none;" class="buy_cart_login">
    <div class="login_top">
    </div>

    <div class="login_content">
        <ul class="login_frm">
            <li>
                <%--<input class="login_email" tabindex="1" id="login_email" name="login_email" maxlength="50" value="Email đăng nhập" title="Email đăng nhập" onblur="javascript:if(this.value == '')this.value='Email đăng nhập';" onfocus="javascript:if(this.value == 'Email đăng nhập') this.value='';" type="text">--%>
                <asp:TextBox runat="server" ID="txtEmailDN" MaxLength="50" ToolTip="Email đăng nhập" Text="Email đăng nhập" CssClass="login_email"></asp:TextBox>
            </li>

            <li>
                <%--<input class="login_pass" tabindex="2" id="login_pass" name="login_pass" maxlength="50" value="123456" title="Mật khẩu đăng nhập" onblur="javascript:if(this.value == '')this.value='123456';" onfocus="javascript:if(this.value == '123456') this.value='';" type="password">--%>
                <asp:TextBox ID="txtPassDN" MaxLength="50" ToolTip="Mật khẩu đăng nhập" runat="server" CssClass="login_pass" Text="!@#$%^" TextMode="Password"></asp:TextBox>
            </li>

            <li>
                <%--<input class="login_button" tabindex="3" id="login_button" name="login_button" value="Đăng nhập" title="" type="button">--%>
                <asp:Button ID="Button1" Text="Đăng nhập" runat="server" OnClick="Button1_Click" CssClass="login_button" />
            </li>
        </ul>

        <%--<ul class="login_show">
                            <li>
                                <input name="remember" value="1" title="Ghi nhớ" type="checkbox">
                            </li>

                            <li>Ghi nhớ
                            </li>

                            <li>|
                            </li>

                            <li>
                                <a href="#top" title="Quên mật khẩu">Quên mật khẩu</a>
                            </li>
                        </ul>--%>
    </div>

    <div class="login_bottom">
    </div>
</div>
<!-- cart-login-end -->

<!-- cart-register-open -->
<p class="buy_cart_title_finish" id="buy_cart_register">
    ĐĂNG KÝ NHANH <span class="buy_cart_title_small">(Vui lòng điền đầy đủ thông tin bên dưới để đặt hàng)</span>
</p>

<script type="text/javascript" charset="utf-8">
    $(document).ready(function () {
        $('.table_buy_register input[name=register_button]').click(function () {

            $('.message_buy_register_show').html("<img src='http://thoitrangdshop.vn/Images/Deal14/loading-mini.gif' width='16px' height='16px' id='imgloading' />");
            var regis_fullname = $('.table_buy_register #regis_fullname').val();
            var city = $('.table_buy_register #city').val();
            var regis_email = $('.table_buy_register #regis_email').val();
            var district = $('.table_buy_register #district').val();
            var regis_pass = $('.table_buy_register #regis_pass').val();
            var ward = $('.table_buy_register #ward').val();
            var regis_repass = $('.table_buy_register #regis_repass').val();
            var regis_number = $('.table_buy_register #regis_number').val();
            //var sex = $('.table_buy_register #regis_sex').val();
            var regis_address = $('.table_buy_register #regis_address').val();
            //var day = $('.table_buy_register #day').val();
            //var month = $('.table_buy_register #month').val();
            //var year = $('.table_buy_register #year').val();
            var regis_building = $('.table_buy_register #regis_building').val();
            var regis_mobile = $('.table_buy_register #regis_mobile').val();

            var datastring = "regis_fullname=" + regis_fullname +
                                "&city=" + city +
                                "&regis_email=" + regis_email +
                                "&district=" + district +
                                "&regis_pass=" + regis_pass +
                                "&ward=" + ward +
                                "&regis_repass=" + regis_repass +
                                "&regis_number=" + regis_number +
//                                                            "&sex=" + sex +
                                "&regis_address=" + regis_address +
//                                                            "&day=" + day +
//                                                            "&month=" + month +
//                                                            "&year=" + year +
                                "&regis_building=" + regis_building +
                                "&regis_mobile=" + regis_mobile;
            $.ajax({
                type: "POST",
                url: "http://thoitrangdshop.vn/registration_ajax.aspx",
                data: datastring,
                cache: false,
                async: false,
                success: function (datacallback) {
                    $('.message_buy_register_show').html("<p><span>" + datacallback + "</span></p>");
                    var regis_success = $('.table_buy_register #regis_success').val();
                    if (regis_success == "1") {
                        $('.message_buy_register_box').addClass("hide");
                        $('.message_buy_register_show').css({ color: "#50BF68" });
                        $('.table_buy_register input,select').val("");
                        $('.table_buy_register input[name=register_button]').val("ĐĂNG KÝ");

                        window.location.href = 'http://thoitrangdshop.vn/buy_2.aspx';
                    }
                    else {
                        $('.message_buy_register_show').css({ color: "#ED314F" });
                        $('.message_buy_register_box').removeClass("hide");
                    }
                }
            });

            //$('.message_buy_register_box').removeClass("hide");
        });

        $('.table_buy_register select[name=city]').ready(function () {

            var datastring = "type=" + "loadcity";
            $.ajax({
                type: "POST",
                url: "http://thoitrangdshop.vn/loadselect_ajax.aspx",
                data: datastring,
                cache: false,
                async: false,
                success: function (datacallback) {
                    $('.table_buy_register #city').html(datacallback);
                }
            });
        });

        $('.table_buy_register select[name=city]').change(function () {

            var city = $('.table_buy_register #city').val();

            var datastring = "type=" + "loaddistrict" + "&city=" + city;
            $.ajax({
                type: "POST",
                url: "http://thoitrangdshop.vn/loadselect_ajax.aspx",
                data: datastring,
                cache: false,
                async: false,
                success: function (datacallback) {
                    $('.table_buy_register #district').html(datacallback);
                }
            });
        });

        $('.table_buy_register select[name=district]').change(function () {

            var district = $('.table_buy_register #district').val();

            var datastring = "type=" + "loadward" + "&district=" + district;
            $.ajax({
                type: "POST",
                url: "http://thoitrangdshop.vn/loadselect_ajax.aspx",
                data: datastring,
                cache: false,
                async: false,
                success: function (datacallback) {
                    $('.table_buy_register #ward').html(datacallback);
                }
            });
        });
    });
</script>

<div class="buy_cart_register buy_register_box">
    <div class="register_top">
    </div>

    <div class="register_content">
        <table class="table_regis_content table_buy_register" border="0" cellpadding="0" cellspacing="0">
            <tbody>
                <tr>
                    <td class="regis_content_title">
                        <label>Họ và tên</label>
                        <span class="text_color_1">*</span>
                    </td>

                    <td class="regis_content_input">
                        <%--<input class="regis_fullname" tabindex="" id="regis_fullname" name="regis_fullname" maxlength="100" title="Họ và tên" type="text">--%>
                        <asp:TextBox CssClass="regis_fullname" ID="txtHoTen" runat="server" MaxLength="50"></asp:TextBox>
                    </td>
                    <td class="regis_content_title">
                        <label>Địa chỉ</label>
                        <span class="text_color_1">*</span>
                    </td>

                    <td class="regis_content_input">
                        <%--<input class="regis_number" tabindex="" id="regis_number" name="regis_number" maxlength="50" title="Số nhà" type="text">--%>
                        <asp:TextBox ID="txtDiaChi" runat="server" MaxLength="50"></asp:TextBox>
                    </td>



                </tr>

                <tr>
                    <td class="regis_content_title">
                        <label>Email</label>
                        <span class="text_color_1">*</span>
                    </td>

                    <td class="regis_content_input">
                        <%--<input class="regis_email" tabindex="" id="regis_email" name="regis_email" maxlength="100" title="Email" type="text">--%>
                        <asp:TextBox ID="txtEmail" runat="server" MaxLength="50"></asp:TextBox>
                    </td>
                    <td class="regis_content_title">
                        <label>Điện thoại</label>
                        <span class="text_color_1">*</span>
                    </td>

                    <td class="regis_content_input">
                        <%--<input class="regis_mobile" tabindex="" id="regis_mobile" name="regis_mobile" maxlength="20" title="Điện thoại" type="text">--%>
                        <asp:TextBox ID="txtDienThoai" runat="server" MaxLength="50"></asp:TextBox>
                    </td>
                </tr>



                <tr>
                    <td class="regis_content_title">
                        <label>Mật khẩu</label>
                        <span class="text_color_1">*</span>
                    </td>

                    <td class="regis_content_input">
                        <%--<input class="regis_pass" tabindex="" id="regis_pass" name="regis_pass" maxlength="100" value="" title="Mật khẩu" type="password">--%>
                        <asp:TextBox ID="txtPass3" runat="server" MaxLength="50" TextMode="Password"></asp:TextBox>
                    </td>




                </tr>

                <tr>
                    <td class="regis_content_title">
                        <label>Nhập lại mật khẩu</label>
                        <span class="text_color_1">*</span>
                    </td>

                    <td class="regis_content_input">
                        <%--<input class="regis_repass" tabindex="" id="regis_repass" name="regis_repass" maxlength="100" value="" title="Nhập lại mật khẩu" type="password">--%>
                        <asp:TextBox ID="txtPass2" runat="server" MaxLength="50" TextMode="Password"></asp:TextBox>
                    </td>


                </tr>
                <tr>
                    <td colspan="4" class="regis_content_button">
                        <%--<input class="regis_button" tabindex="" id="register_button" name="register_button" value="ĐĂNG KÝ" title="" type="button">--%>
                        <asp:Button ID="Button2" Text="Đăng ký" runat="server" OnClientClick="return script2()" OnClick="Unnamed1_Click" CssClass="regis_button"  />
                    </td>
                </tr>
            </tbody>
        </table>

    </div>

    <div class="register_bottom">
    </div>
</div>
<!-- cart-register-end -->
<%--            </div>--%>